Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix(#21): bulk api delete 오류 수정 #39

Merged
merged 1 commit into from
Jul 29, 2024
Merged

Fix(#21): bulk api delete 오류 수정 #39

merged 1 commit into from
Jul 29, 2024

Conversation

klaus9267
Copy link
Owner

No description provided.

@klaus9267 klaus9267 merged commit 8827313 into main Jul 29, 2024
1 check passed
"DELETE FROM votes",
"DELETE FROM reactions",
"DELETE FROM comments",
"DELETE FROM posts"
"DELETE FROM posts",
"SET FOREIGN_KEY_CHECKS = 1"
};

jdbcTemplate.batchUpdate(sqls);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

변경된 코드의 문제 및 개선 제안:

  1. deleteReactions() 메서드:

    • FOREIGN KEY CHECK를 0으로 설정하고 유지하지 않은 채로 reactions 테이블에서만 데이터를 삭제할 수 있습니다.
    • 마지막에 FOREIGN KEY CHECKS를 1로 설정하는 것이 좋습니다.
  2. deleteComments() 메서드:

    • 현재 코드에 오류나 변경 사항은 없어 보입니다.
  3. deletePosts() 메서드:

    • FOREIGN KEY CHECK를 0으로 설정하고 유지하지 않은 채로 votes, reactions, commentsposts 테이블에서 데이터를 삭제합니다.
    • 마지막에 FOREIGN KEY CHECKS를 1로 설정해야 합니다.

개선 제안:

  • 각 메서드에서 FOREIGN KEY CHECKS를 활성화/비활성화하여 일관성을 유지하도록 합니다.
  • 각 SQL 명령문 실행 후 적절한 로깅 또는 예외 처리를 추가하여 데이터의 손실을 방지할 수 있습니다.
  • 코드 주석을 추가하여 각 단계의 의도를 설명하면 이해하기 쉬울 것입니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant